<?php
echo $this->headLink()->prependStylesheet($this->baseUrl().'/css/order_cart.css');
echo $this->headLink()->prependStylesheet($this->baseUrl().'/css/datatables/demo_page.css');
echo $this->headLink()->prependStylesheet($this->baseUrl().'/css/datatables/demo_table_jui.css');
echo $this->headLink()->prependStylesheet($this->baseUrl().'/css/datatables/demo_table.css');
echo $this->headLink()->prependStylesheet($this->baseUrl().'/css/ui-darkness/jquery-ui-1.8.16.custom.css');
echo $this->headScript()->appendFile($this->baseUrl().'/js/jquery-1.6.2.min.js');
echo $this->headScript()->appendFile($this->baseUrl().'/js/jquery-ui-1.8.16.custom.min.js');
echo $this->headScript()->appendFile($this->baseUrl().'/js/datatables/jquery.dataTables.min.js');
?>
<script type="text/javascript">
$(document).ready(function(){
	$('#table').dataTable( {
		"bJQueryUI": true
	});
});
</script>
<?php
$this->title = "Create Order";
$this->headTitle($this->title);
?>
<h1><a href="<?php echo $this->url(array('controller'=>'index', 'action'=>'index'), null, true); ?>">Home</a> > <?php echo $this->escape($this->title); ?></h1>
<div class="cont">
<?php echo $this->form; ?>
<div class="gap"></div>

<!-- class buttons should be here. Do not use db variable for this button. Use session variable from controller. -->
<div class="gap10"></div>
<div class="table">
<table id="table">
<thead>
	<tr>
		<th>Product No</th>
		<th>Name</th>
		<th>Description</th>
		<th>Price</th>
		<th>Quantity</th>
		<th>Remove</th>
	</tr>
</thead>
<tbody>
	<?php if (isset($this->dbs)) { foreach($this->dbs as $db) : ?>
	<tr>
		<td><?php echo $this->escape($db->prod_no); ?></td>
		<td><?php echo $this->escape($db->prod_name); ?></td>
		<td><?php echo $this->escape($db->prod_description); ?></td>
		<td><?php echo $this->escape($db->prod_price); ?></td>
		<td><?php echo $this->escape($db->item_qty); ?></td>
		<td><a href="<?php echo $this->url(array('controller'=>'order', 'action'=>'itemdel', 'item_no'=>$db->item_no))?>">Delete</a></td>
	</tr>
	<?php endforeach; } ?>
</tbody>
</table>
</div>
<span class="buttons"><a class="button" href = "<?php 
	if (isset($db->order_no)) {
		echo $this->url(array('controller'=>'order', 'action'=>'review', 'order_no'=>$db->order_no ));
	} else {
		echo $this->url(array('controller'=>'order', 'action'=>'cart'));
	}
?>">Continue</a>
<a class="button" href = "<?php
	if (isset($db->order_no)) {
		echo $this->url(array('controller'=>'order', 'action'=>'delete', 'order_no'=>$db->order_no));
	} else {
		echo $this->url(array('controller'=>'order', 'action'=>'delete'));
	}
?>">Cancel</a>
</span>
</div>